home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 4 / Apprentice-Release4.iso / Source Code / PowerPlant / CGI++ Framework / Support Classes / LCHandleStream.cp < prev    next >
Encoding:
Text File  |  1995-11-17  |  2.4 KB  |  113 lines  |  [TEXT/CWIE]

  1. // ===========================================================================
  2. //    LCHandleStream.cp                ©1993 Brian Todoroff All rights reserved.
  3. //    Version 1.0b
  4. // ===========================================================================
  5. //
  6. //  This class may only be distributed as part of the CGI++ Framework.  For
  7. //  further information contact the author at btodorof@hmc.edu.
  8. //
  9. //    A subclass of LHandleStream that adds << operators for output. This version
  10. //    includes special modifiers for HTML.
  11.  
  12. #ifdef PowerPlant_PCH
  13. #include PowerPlant_PCH
  14. #endif
  15.  
  16. #include "LCHandleStream.h"
  17.  
  18.  
  19. // ---------------------------------------------------------------------------
  20. //        • LCHandleStream
  21. // ---------------------------------------------------------------------------
  22. //    Default Constructor
  23.  
  24. LCHandleStream::LCHandleStream()
  25.     :LHandleStream()
  26. {
  27. }
  28.  
  29.  
  30. // ---------------------------------------------------------------------------
  31. //        • LCHandleStream(Handle)
  32. // ---------------------------------------------------------------------------
  33. //    Construct from an existing Handle
  34. //
  35. //    The LHandleStream object assumes control of the Handle
  36.  
  37. LCHandleStream::LCHandleStream(Handle inHandle)
  38.     :LHandleStream(inHandle)
  39. {
  40. }
  41.  
  42.  
  43. // ---------------------------------------------------------------------------
  44. //        • ~LCHandleStream
  45. // ---------------------------------------------------------------------------
  46. //    Destructor
  47. LCHandleStream::~LCHandleStream()
  48. {
  49. }
  50.  
  51.  
  52.  
  53. Int32 LCHandleStream::WriteCStr(const void *inString)
  54. {
  55.     return LHandleStream::WriteData(inString,strlen((char *)inString));
  56. }
  57.  
  58. LCHandleStream &LCHandleStream::operator<<(char *inStr)
  59. {
  60.     WriteCStr(inStr);
  61.     return *this;
  62. }
  63.  
  64. LCHandleStream &LCHandleStream::operator<<(Handle inH)
  65. {
  66.     HLock(inH);
  67.     WriteData(*inH,GetHandleSize(inH));
  68.     HUnlock(inH);
  69.     return *this;
  70. }
  71.  
  72. LCHandleStream &LCHandleStream::operator<<(char inChar)
  73. {
  74.     WriteData(&inChar,1);
  75.     return *this;
  76. }
  77.  
  78. LCHandleStream &LCHandleStream::operator<<(int inInt)
  79. {
  80.     char *t=new char[10];
  81.     sprintf(t,"%d",inInt);
  82.     WriteCStr(t);
  83.     delete t;
  84.     return *this;
  85. }
  86.  
  87.  
  88. LCHandleStream &endl(LCHandleStream &stream)
  89. {
  90.     stream<<brkl<<crlf;
  91.     return stream;
  92. }
  93.  
  94. LCHandleStream &brkl(LCHandleStream &stream)
  95. {
  96.     stream<<"<br>";
  97.     return stream;
  98. }
  99.  
  100. LCHandleStream &newl(LCHandleStream &stream)
  101. {
  102.     stream<<(char)0x0D;
  103.     return stream;
  104. }
  105.  
  106. LCHandleStream &crlf(LCHandleStream &stream)
  107. {
  108.     stream<<(char)0x0D<<(char)0x0A;
  109.     return stream;
  110. }
  111.  
  112.  
  113.